import type { Hospital } from './model';

import type { ID, PageResult } from '#/api/common';

import { requestClient } from '#/api/request';

enum Api {
  hospitalDelete = '/hospital/v1/deleteHospital',
  hospitalList = '/hospital/v1/pageList',
  hospitalSave = '/hospital/v1/saveHospital',
  hospitalUpdate = '/hospital/v1/updateHospital',
}

/**
 * 医院分页列表
 * @param data 请求参数
 * @returns 列表
 */
export function hospitalList(data?: any) {
  return requestClient.post<PageResult<Hospital>>(Api.hospitalList, data);
}

/**
 * 新增医院
 * @param data 参数
 */
export function hospitalAdd(data: Partial<Hospital>) {
  return requestClient.postWithMsg<void>(Api.hospitalSave, data);
}

/**
 * 更新医院
 * @param data 参数
 */
export function hospitalUpdate(data: Partial<Hospital>) {
  return requestClient.postWithMsg<void>(Api.hospitalUpdate, data);
}

/**
 * 删除医院
 * @param hospitalId 医院ID
 */
export function hospitalRemove(hospitalId: ID) {
  return requestClient.get<void>(`${Api.hospitalDelete}?id=${hospitalId}`);
}
